import uniqueId from '@form-create/utils/lib/unique'
import { localeProps } from '../../utils'

const label = '样式选择器'
const name = 'DkStyleInput'

export default {
  menu: 'high',
  icon: 'devicon:css3',
  label,
  name,
  event: ['blur', 'focus', 'change', 'input', 'clear'],
  rule() {
    return {
      type: name,
      field: uniqueId(),
      title: '样式',
      info: '',
      $help: '',
      $required: false,
      props: {
        isDrawer: true
      }
    }
  },
  props(_, { t }) {
    return localeProps(t, name + '.props', [
      {
        type: 'select',
        field: 'hideComponents',
        title: '隐藏的组件',
        value: [],
        props: {
          multiple: true
        },
        options: [
          { label: '尺寸', value: 'DkStyleBoxInput' },
          { label: '文字', value: 'DkStyleFontInput' },
          { label: '背景', value: 'DkStyleBackgroundInput' },
          { label: '边框', value: 'DkStyleBorderInput' },
          { label: '阴影', value: 'DkStyleShadowInput' },
          { label: '自定义', value: 'DkStyleCustomInput' }
        ]
      },
      {
        type: 'switch',
        field: 'isDrawer',
        title: '抽屉模式',
        value: false,
        control: [
          {
            value: true,
            rule: [
              {
                type: 'input',
                field: 'drawerText',
                title: '按钮标题',
                value: '编辑样式'
              }
            ]
          }
        ]
      }
    ])
  }
}
